<template>
	<div class="videoContent">
		<video v-if="config.dataSources.videoId"
			   :autoplay="config.dataSources.auto"
			   :loop="config.dataSources.loop"
			   controls
			   preload="auto" width="100%">
			<source :src="getFilePath(config.dataSources.videoId)" type="video/mp4">
		</video>
	</div>
</template>

<script>
import ComponentView from "@/views/modules/preview/components/common/component-view.js";
import {Util,TokenUtil} from "@lowcode/jpaas-base-lib";
export default {
	name: "video-view",
	mixins:[ComponentView],
	data(){
		return{
		}
	},
	methods:{
		getFilePath(fileId){
      let token = TokenUtil.getToken();
      fileId=Util.encryptWord(fileId);
			return "/api/api-system/system/core/sysFile/previewFile?fileId=" + fileId + "&accessToken=" + token;
		},
	},
	watch:{
	}
}
</script>

<style scoped>
.videoContent {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}
.videoContent video {
	width: 100%;
	object-fit: fill;
}
</style>
